{% comment %} ----------------------------------------------------------------*\
 |  account.html                                                              |
 |                                                                            |
 |  Copyright (c) 2009-2010, Code A La Mode, original authors.                |
 |                                                                            |
 |      This file is part of imi-imi.                                         |
 |                                                                            |
 |      imi-imi is free software; you can redistribute it and/or modify       |
 |      it under the terms of the GNU General Public License as published by  |
 |      the Free Software Foundation, either version 3 of the License, or     |
 |      (at your option) any later version.                                   |
 |                                                                            |
 |      imi-imi is distributed in the hope that it will be useful,            |
 |      but WITHOUT ANY WARRANTY; without even the implied warranty of        |
 |      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
 |      GNU General Public License for more details.                          |
 |                                                                            |
 |      You should have received a copy of the GNU General Public License     |
 |      along with imi-imi.  If not, see <http://www.gnu.org/licenses/>.      |
\*------------------------------------------------------------- {% endcomment %}


<div id="profile">
    {% if current_user and target_user %}
        {% ifequal current_user target_user %}
            <a href="http://en.gravatar.com/site/login/">
        {% endifequal %}
    {% endif %}

    <img src="{{ target_user|user_to_gravatar:199 }}"
         class="gravatar
                {% if current_user and target_user %}
                    {% ifequal current_user target_user %}
                        change_my_gravatar
                    {% endifequal %}
                {% endif %}"
        {% if current_user and target_user %}
            {% ifequal current_user target_user %}
                title="Click on your profile picture to change it."
                alt="Click on your profile picture to change it."
            {% endifequal %}
        {% endif %}
    />

    {% if current_user and target_user %}
        {% ifequal current_user target_user %}
            </a>
        {% endifequal %}
    {% endif %}

    {% if current_user and target_user %}
        {% ifnotequal current_user target_user %}
            <form id="follow" action="/users" method="post">
                <input name="current_user_id" type="hidden"
                       value="{{ current_user.user_id }}" />
                <input name="nickname" type="hidden"
                       value="{{ target_user.nickname }}" />
                <input name="email" type="hidden"
                       value="{{ target_user.email }}" />
                <input class="submit" type="submit"
                       value="{% if current_user|following:target_user %}stop following{% else %}follow{% endif %}" />
            </form>
        {% endifnotequal %}
    {% endif %}
</div>

<div class="user_patchwork_quilt">
    <p>
        Who
        <a href="/users/{{ target_user.email }}">
            {{ target_user.nickname }}
        </a>
        follows
    </p>

    <ul id="following">
        {% for user in target_account.following %}<li id="following_{{ user.user_id }}"><a href="/users/{{ user.email }}"><img src="{{ user|user_to_gravatar:40 }}" class="gravatar" title="{{ user.nickname }}" alt="{{ user.nickname }}" /></a></li>{% endfor %}
    </ul>
</div>

<div class="user_patchwork_quilt">
    <p>
        Who follows
        <a href="/users/{{ target_user.email }}">
            {{ target_user.nickname }}
        </a>
    </p>

    <ul id="followers">
        {% for user in target_account.followers %}<li id="follower_{{ user.user_id }}"><a href="/users/{{ user.email }}"><img src="{{ user|user_to_gravatar:40 }}" class="gravatar" title="{{ user.nickname }}" alt="{{ user.nickname }}" /></a></li>{% endfor %}
    </ul>
</div>
